﻿#ifndef WEBSOCKETCLIENT_H
#define WEBSOCKETCLIENT_H

#include <QObject>
#include <QWebSocket>
#include <QUrl>

class WebSocketClient : public QObject
{
    Q_OBJECT
public:
    explicit WebSocketClient(const QUrl &url,QObject *parent = nullptr);
    ~WebSocketClient();

private slots:
    void onConnected();  // 连接成功时调用
    void onTextMessageReceived(const QString &message);  // 接收到消息时调用
    void onDisconnected();  // 断开连接时调用

private:
    QWebSocket m_webSocket;  // WebSocket 客户端对象
};

#endif // WEBSOCKETCLIENT_H
